<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.global.js"></script>
  <script src="./axios.js"></script>
  <script>
    const request = axios.create({
      baseURL: 'https://api.it120.cc/conner',
      timeout: 6000,
      headers: {
        token: 'cccdddeee'
      }
    })
    const { createApp} = Vue;
    const app = createApp();
   
    const CommonHead =  {
      template: `
        <div>
          <h2>头部组件</h2> 
          <ul>
            
          </ul> 
        </div>
      `,
      data(){
        return {
          blogs: [],
          cates: []
        }
      },
      methods: {
        fetchBlogs(){
          request({
            url: '/cms/news/list/v2',
            method: 'post',
            data: {
              a: 10,
              b: 20
            }
          }).then(res => {
            if (res.data.code === 0) {
              this.blogs = res.data.data.result
            }
          })
        },
        fetchCates(){
          request({
            url: '/cms/category/list',
            method: 'get',
            params: {
              a: 10,
              b: 20
            }
          }).then(res => {
            if (res.data.code === 0) {
              this.cates = res.data.data
            }
          })
        }
      },
      created () {
        this.fetchBlogs();
        this.fetchCates();
      }
    }
    app.component('CommonHead', CommonHead)

    app.mount('#app')
  </script>
</body>
</html>

<!-- 

  {
    a: [1,2,3]
  }
  "a=1&a=2&a=3"
 -->